package cn.itcast.jx.service.impl;

import java.io.Serializable;
import java.util.List;

import cn.itcast.jx.dao.BaseDao;
import cn.itcast.jx.domain.Factory;
import cn.itcast.jx.service.FactoryService;
import cn.itcast.jx.util.Page;
import cn.itcast.jx.util.UtilFuns;

public class FactoryServiceImpl implements FactoryService{

	private BaseDao baseDao;

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}

	@Override
	public Page<Factory> findPage(String hql, Page<Factory> page,
			Class<Factory> entityClass, Object[] params) {
		return baseDao.findPage(hql, page, entityClass, params);
	}

	@Override
	public Factory get(Class<Factory> entityClass, Serializable id) {
		// TODO Auto-generated method stub
		return baseDao.get(entityClass, id);
	}

	@Override
	public void saveOrUpdate(Factory entity) {
		if(UtilFuns.isEmpty(entity.getId())) {
			//新增
		
			
		}else {
			//修改
			
			
			//更新
			baseDao.saveOrUpdate(entity);
			
		}
	}

	@Override
	public void delete(Class<Factory> entityClass, String[] ids) {
		for (String id : ids) {
			baseDao.deleteById(entityClass, id);
		}
	}

	@Override
	public List<Factory> find(String hql, Class<Factory> entityClass,
			Object[] params) {
		// TODO Auto-generated method stub
		return baseDao.find(hql, entityClass, params);
	}
	
}
